//
//  SAWAssignModel.m
//  优学荟管理系统
//
//  Created by edz on 2018/1/29.
//  Copyright © 2018年 星道三好. All rights reserved.
//

#import "SAWAssignModel.h"

@implementation SAWAssignModel

-(void)getUserXQ:(NSArray *)arr withData:(void(^)(NSArray *array))succedDic
{
    
    
    NSString *url= [NSString stringWithFormat:@"assignHomework.do?action=getKnowpointlist&unitCode=%@&pageNumber=%@",arr[0],arr[1]];
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    [SVProgressHUD setDefaultStyle:(SVProgressHUDStyleCustom)];
    [SVProgressHUD  setBackgroundColor:ColorRGB(4, 4, 4)];
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    [SVProgressHUD showWithStatus:LLLoading];
    
    
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        
        if ([[Obj valueForKey:@"code"]integerValue] == 1000) {
            [SVProgressHUD dismiss];
            
            
            if (succedDic) {
                succedDic(Obj[@"t"][@"dataList"]);
            }
            
            
        }
        
        else {
            [SVProgressHUD showErrorWithStatus:Obj[@"msg"]];
            
        }
        
        
        
        
    } Fail:^(NSError *Error) {
        [SVProgressHUD showErrorWithStatus:NetErr];
        
    }];
    
    
    
    
}
//选入
-(void)getItemData:(NSArray *)arr withData:(void(^)())succedDic
{
    
    
    NSString *url= [NSString stringWithFormat:@"assignHomework.do?action=setKnowpointHomeWork&homewordId=%@&knowledgeId=%@",arr[0],arr[1]];
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    [SVProgressHUD setDefaultStyle:(SVProgressHUDStyleCustom)];
    [SVProgressHUD  setBackgroundColor:ColorRGB(4, 4, 4)];
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    [SVProgressHUD showWithStatus:LLLoading];
    
    
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        
        if ([[Obj valueForKey:@"code"]integerValue] == 1000) {
            [SVProgressHUD dismiss];
            
            
           [SVProgressHUD showErrorWithStatus:Obj[@"msg"]];
            
            if(succedDic)
            {
                succedDic();
            }
        }
        
        else {
            [SVProgressHUD showErrorWithStatus:Obj[@"msg"]];
            
        }
        
        
        
        
    } Fail:^(NSError *Error) {
        [SVProgressHUD showErrorWithStatus:NetErr];
        
    }];
    
    
    
    
}

@end
